package com.mxpio.erp.common.inventory.entity;

import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.Dept;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_INV_WAREHOUSE_AREA")
@Schema(description="仓库库区管理")
public class WarehouseArea extends BaseEntity {

	private static final long serialVersionUID = 1L;
	@Id
	@Generator(policy = ResCodeGeneratorPolicy.class)
	@Column(name = "AREA_CODE_", updatable = false)
	@Schema(description = "库区编号")
	private String areaCode;

	@Column(name = "AREA_NAME_")
	@Schema(description = "库区名称")
	private String areaName;

	@Column(name = "REGION_CODE_", updatable = false)
	@Schema(description = "所属区域编号")
	@Dict(dicCode = "regionCode" ,dicEntity = WarehouseRegion.class, dicText = "regionName")
	private String regionCode;

	@Column(name = "WH_CODE_")
	@Schema(description = "所属仓库编号")
	@Dict(dicCode = "whCode" ,dicEntity = Warehouse.class, dicText = "whName")
	private String whCode;
	
	@Column(name = "AREA_KEEPER_")
	@Schema(description = "库区负责人")
	@Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
	private String areaKeeper;

	@Column(name = "AREA_TYPE_")
	@Schema(description = "库区类型")//ERP_INV_WH_AREA_TYPE 1合格2不合格区
	@Dict(dicCode = "ERP_INV_WH_AREA_TYPE")
	private String areaType;

	@Column(name = "TELEPHONE_")
	@Schema(description = "联系电话")
	private String telephone;

	@Column(name = "DEPT_CODE_")
	@Schema(description = "所属部门")
	@Dict(dicCode = "deptCode", dicEntity = Dept.class, dicText = "deptName")
	private String deptCode;
	
	@Column(name = "AREA_STATUS_")
	@Schema(description = "是否启用")
	@Dict(dicCode = "ERP_COMMON_YESNO")
	private String areaStatus;

	@Column(name = "MEMO_")
	@Schema(description = "备注")
	private String memo;
}
